package com.cg.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cg.entity.CgCommunicationUser;
import com.cg.mapper.CgCommunicationUserMapper;
import com.cg.service.ICgCommunicationUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zc
 * @since 2020-11-25
 */
@Service
public class CgCommunicationUserServiceImpl extends ServiceImpl<CgCommunicationUserMapper, CgCommunicationUser> implements ICgCommunicationUserService {
    @Autowired(required = false)
    CgCommunicationUserMapper communicationUserMapper;

    @Override
    public List<CgCommunicationUser> queryAll() {
        QueryWrapper<CgCommunicationUser> communicationUserQueryWrapper = new QueryWrapper<>();

        List<CgCommunicationUser> communicationUser = communicationUserMapper.selectList(communicationUserQueryWrapper);
        //List<CommunicationUser> communicationUser = baseMapper.selectList(communicationUserQueryWrapper);
        return communicationUser;
    }

    @Override
    public String queryUserName(String userName) {
        QueryWrapper<CgCommunicationUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_name",userName);
        return communicationUserMapper.selectOne(queryWrapper).toString();
    }
}
